package cn.mxz.controller;

import cn.mxz.pojo.ResultData;
import cn.mxz.service.impl.CategoryServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 作者；朱洪旭
 * 时间；2021/12/3 11:09
 */
@RestController
@CrossOrigin
@RequestMapping("/categorylevel")
public class CategoryController {
    @Autowired
    private CategoryServiceImpl categoryService;
    //查询一级分类的category
    @GetMapping
    public ResultData selectlevel1(Integer parentid){
        if(parentid==null){
            parentid=0;
        }
        ResultData resultData = categoryService.selectLevel1(parentid);
        return  resultData;
    }

}
